home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / CRT.SWG / 0028_Fast Direct VIDEO writes.pas < prev    next >
Pascal/Delphi Source File  |  1995-02-28  |  1KB  |  51 lines

  1.  
  2. rogram DirectW;
  3. {
  4.   This program shows how to write directly to video memory.
  5.   It will not work in protected mode. There is no reason
  6.   to believe that this runs any faster than the CRT's
  7.   Write procedure, but we're putting it out on the BBS in
  8.   case you are interested.
  9.  
  10.   As always, this program comes with no guarrantees and even
  11.   less support.
  12. }
  13.  
  14. var
  15.   VS: Word;
  16.  
  17. function VidSeg : Word;
  18. begin
  19.   If Mem[$0000:$0449] = 7 Then VidSeg := $B000
  20.   Else VidSeg := $B800;
  21. end;
  22.  
  23. function MakeWord(H, L: Byte): Word; assembler;
  24. asm
  25.   mov ah, h
  26.   mov al, L
  27. end;
  28.  
  29. procedure WriteStr(x, y: Integer; var WriteStr: String; Attr: Integer);
  30. var
  31.   i: Integer;
  32.   Loc: Integer;
  33. begin
  34.   dec(y);
  35.   dec(x);
  36.   Loc := (80 * y + x) * 2;
  37.   for i := 1 to Length(WriteStr) do begin
  38.     MemW[VS:Loc] := MakeWord(Attr, Ord(WriteStr[i]));
  39.     inc(Loc, 2);
  40.   end;
  41. end;
  42.  
  43. var
  44.   S : String;
  45. begin
  46.   S := 'Sambo';
  47.   VS := VidSeg;
  48.   WriteStr(10,10, S, 14 + 1 * 16);
  49.   ReadLn;
  50. end.
  51.